<template>
	<view class="page">
		<view class="bg-white flex align-center justify-between padding-lr padding-tb-sm">
			<u-icon name="arrow-left" size="24rpx" color="#999" @click="getYestoday"></u-icon>
			<u-text align="center" margin="0 20rpx" color="#333" size="34rpx" :text="calendarDate"
				@click="showCalendar = true"></u-text>
			<u-icon name="arrow-right" size="24rpx" color="#999" @click="getNextDay"></u-icon>
		</view>
		<view class="bg-white solid-top">
			<u-tabs :scrollable="false" :list="tabs" @change="handleChange"></u-tabs>
		</view>
		<view class="main">
			<view class="print-list" v-if="currentTab === 0">
				<view class="flex align-center justify-between bg-white radius-lg padding margin-bottom">
					<view class="flex-1">
						<text class="text-lg text-gray text-bold">讲师的练习题</text>
						<text class="text-df text-muted margin-left">5月17日</text>
					</view>
					<u-text align="right" text="待打印" size="28rpx" color="#333"></u-text>
				</view>
			</view>
			<view class="print-list" v-if="currentTab === 1">
				<view class="flex align-center justify-between bg-white radius-lg padding margin-bottom">
					<view class="flex-1">
						<text class="text-lg text-gray text-bold">讲师的练习题</text>
						<text class="text-df text-muted margin-left">5月17日</text>
					</view>
					<u-text align="right" text="已打印" size="28rpx" color="#333"></u-text>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import dayjs from 'dayjs'
const calendarDate = ref(dayjs().format('YYYY-MM-DD'));
const currentTab = ref(0)

const tabs = ref([
	{
		name: '待打印',
		value: '待打印'
	},
	{
		name: '已打印',
		value: '已打印'
	}
])

const handleChange = (index) => {
	console.log(index)
	currentTab.value = index.index
}

// 昨天
const getYestoday = () => {
	console.log('昨天')
	calendarDate.value = dayjs(calendarDate.value).subtract(1, 'day').format('YYYY-MM-DD')
}

// 明天
const getNextDay = () => {
	console.log('明天')
	calendarDate.value = dayjs(calendarDate.value).add(1, 'day').format('YYYY-MM-DD')
}

</script>

<style></style>
